using Autofac;
using CommonServiceLocator;
using GalaSoft.MvvmLight;
using System.Windows;

namespace VisionAppManager.ViewModel
{
    /// <summary>
    /// This class contains properties that the main View can data bind to.
    /// <para>
    /// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
    /// </para>
    /// <para>
    /// You can also use Blend to data bind with the tool's support.
    /// </para>
    /// <para>
    /// See http://www.galasoft.ch/mvvm
    /// </para>
    /// </summary>
    public class MainViewModel : ViewModelBase
    {
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}
            ///
            //if (!DecriptionHelper.DecriptionHelper.CheckKeyFile("Depalletizing"))
            //{
            //    MessageBoxResult result = MessageBox.Show("Wrong License!", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
            //    System.Environment.Exit(0);
            //}
        }

        public VMRibbonMenu VMRibbonMenu
        {
            get
            {
                //return ServiceLocator.Current.GetInstance<VMRibbonMenu>();
                return AppEngine.Container.Resolve<VMRibbonMenu>();
            }
        }

        public VMCfg VMCfg
        {
            get
            {
                //return ServiceLocator.Current.GetInstance<VMCfg>();
                return AppEngine.Container.Resolve<VMCfg>();
            }
        }

        public VMSearch VMSearch
        {
            get
            {
                //return ServiceLocator.Current.GetInstance<VMSearch>();
                return AppEngine.Container.Resolve<VMSearch>();
            }
        }

        public VMLog VMLog
        {
            get
            {
                //return ServiceLocator.Current.GetInstance<VMLog>();
                return AppEngine.Container.Resolve<VMLog>();
            }
        }
        public VMHelp VMHelp
        {
            get
            {
                //return ServiceLocator.Current.GetInstance<VMHelp>();
                return AppEngine.Container.Resolve<VMHelp>();
            }
        }
        public VMStatistic VMStatistic
        {
            get
            {
                //return ServiceLocator.Current.GetInstance<VMStatistic>();
                return AppEngine.Container.Resolve<VMStatistic>();
            }
        }
        public VMImgViewer VMImgViewer
        {
            get
            {
                //return ServiceLocator.Current.GetInstance<VMImgViewer>();
                return AppEngine.Container.Resolve<VMImgViewer>();
            }
            set {; }
        }
        public VMImgViewerCam1 VMImgViewerCam1
        {
            get
            {
                //return ServiceLocator.Current.GetInstance<VMImgViewerCam1>();
                return AppEngine.Container.Resolve<VMImgViewerCam1>();
            }
            set {; }
        }
        public VMImgViewerCam2 VMImgViewerCam2
        {
            get
            {
                //return ServiceLocator.Current.GetInstance<VMImgViewerCam2>();
                return AppEngine.Container.Resolve<VMImgViewerCam2>();
            }
            set {; }
        }



        public VMStatusBar VMStatusBar
        {
            get
            {
                //return ServiceLocator.Current.GetInstance<VMStatusBar>();
                return AppEngine.Container.Resolve<VMStatusBar>();
            }
        }

        private ViewModelBase vmWorkspace;
        public ViewModelBase VMWorkspace
        {
            get
            {
                return vmWorkspace;
            }
            set
            {
                Set<ViewModelBase>(ref vmWorkspace, value);
            }
        }

    }
}